﻿
//发送消息
function msgReceive() {
    if (this.req.responseText == "failed") {
        alert("发送失败！");
    }
    else {
        document.getElementById(source.id + "_chatWindow_OutPut").value += this.req.responseText + '\n';
    }
}
function sendMessage(source) {
    var msg = document.getElementById(source.id + "_chatWindow_InPut").value;
    if (msg == "") return;
    document.getElementById(source.id + "_chatWindow_InPut").value = "";
    document.getElementById(source.id + "_chatWindow_OutPut").value += document.getElementById("name").value + " : " + msg+'\n';
    document.getElementById(source.id + "_chatWindow_OutPut").scrollTop = document.getElementById(source.id + "_chatWindow_OutPut").scrollHeight;

    var url = "AjaxResponse/Chat.aspx?From=" + document.getElementById("name").value + "&To=" + source.id + "&Content=" + escape(msg); //excape针对中文乱码问题
    new ContentLoader(url, msgReceive); 
}